package com.kgc.basicprovider.controller;

import com.kgc.basic.pojo.BOM;
import com.kgc.basic.remote.BOMRemote;
import com.kgc.basic.util.ResponseMsg;
import com.kgc.basicprovider.service.BOMService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.Map;
@Controller
public class BOMController implements BOMRemote {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private BOMService bomService;

    @Override
    public ResponseMsg getBOMPage(Map<String, Object> map) {
        logger.info("BOMController getBOMPage map={}", map);
        ResponseMsg responseMsg = bomService.getBOMPage(map);
        logger.info("bomService getBOMPage responseMsg={}", responseMsg+",map="+map);
        return responseMsg;
    }

    @Override
    public ResponseMsg addBOM(BOM bom) {
        logger.info("BOMController addBOM bom={}", bom);
        ResponseMsg responseMsg = bomService.addBom(bom);
        logger.info("bomService addBOM responseMsg={}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg updateBOM(BOM bom) {
        logger.info("BOMController updateBOM bom={}", bom);
        ResponseMsg responseMsg = bomService.updateBom(bom);
        logger.info("bomService updateBOM responseMsg={}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg delBOM(String id) {
        logger.info("BOMController delBOM bom={}", id);
        ResponseMsg responseMsg = bomService.deleteBom(id);
        logger.info("bomService delBOM responseMsg={}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg getBOMById(String id) {
        logger.info("BOMController getBOMById bom={}", id);
        ResponseMsg responseMsg = bomService.getBomById(id);
        logger.info("bomService getBOMById responseMsg={}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg getAllBOM() {
        logger.info("BOMController getAllBOM");
        ResponseMsg responseMsg = bomService.getAllBom();
        logger.info("bomService getAllBOM responseMsg={}", responseMsg);
        return responseMsg;
    }
}
